package com.it.park.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.it.park.client.service.base.BaseService;
import com.it.park.dao.base.BaseMapper;

@Service("baseService")
public class BaseServiceImpl<T> implements BaseService<T>{

	@Autowired
	private BaseMapper<T> baseMapper;
	
	@Override
	public boolean deleteByPrimaryKey(Integer id) {
		return baseMapper.deleteByPrimaryKey(id)==1;
	}

	@Override
	public boolean insert(T record) {
		return baseMapper.insert(record)==1;
	}

	@Override
	public boolean insertSelective(T record) {
		return baseMapper.insertSelective(record)==1;
	}

	@Override
	public T selectByPrimaryKey(Integer id) {
		return baseMapper.selectByPrimaryKey(id);
	}

	@Override
	public boolean updateByPrimaryKeySelective(T record) {
		return baseMapper.updateByPrimaryKeySelective(record)==1;
	}

	@Override
	public boolean updateByPrimaryKeyWithBLOBs(T record) {
		return baseMapper.updateByPrimaryKeyWithBLOBs(record)==1;
	}

	@Override
	public boolean updateByPrimaryKey(T record) {
		return baseMapper.updateByPrimaryKey(record)==1;
	}

	@Override
	public List<T> selectAll() {
		return baseMapper.selectAll();
	}

	@Override
	public List<T> selectPagination(Map<String, Object> map) {
		return baseMapper.selectPagination(map);
	}

	@Override
	public Integer selectTotal(Map<String, Object> map) {
		return baseMapper.selectTotal(map);
	}

	@Override
	public List<T> selectPagination(T t) {
		return baseMapper.selectPagination(t);
	}

	@Override
	public Integer selectTotal(T t) {
		return baseMapper.selectTotal(t);
	}

	@Override
	public boolean batchInsert(List<T> records) {
		return baseMapper.batchInsert(records) > 0;
	}

	@Override
	public int batchUpdate(List<T> records) {
		return baseMapper.batchUpdate(records);
	}

	@Override
	public int batchDelete(List<T> records) {
		return baseMapper.batchDelete(records);
	}

	@Override
	public T selectByModel(T t) {
		return baseMapper.selectByModel(t);
	}

	@Override
	public boolean deleteByModel(T t) {
		return baseMapper.deleteByModel(t)==1;
	}


}
